import { Menu } from "@/api/interface/index";
import { PORT1 } from "@/api/config/servicePort";
import http from "@/api";

/**
 * @name 权限管理
 */

//全部菜单列表
export const getAllMenuListApi = (params: FormData) => {
  return http.get<Menu.MenuOptions[]>(PORT1+`/sys/auth/menu-all`, params, { cancel: false });
};


//新增 编辑权限
export const authSaveApi = (params: FormData) => {
  return http.post<Menu.collect>(PORT1+`/sys/auth/save`, params, { cancel: false });
};

//获取权限列表数据
export const getAuthListApi = (params) => {
  return http.post(PORT1+`/sys/auth/auth-all`, params, { cancel: false });
};


//删除权限
export const getDelAuthApi = (params) => {
  return http.get(PORT1+`/sys/auth/delete`, params, { cancel: false });
};





//分配权限列表
export const permissionAuthHeaderApi = (params) => {
  return http.get(PORT1+'/personnel/user-set-auth/field', params, { cancel: false });
};
//分配权限列表表头
export const permissionAuthListApi = (params) => {
  return http.post(PORT1+'/personnel/user-set-auth/list', params, { cancel: false });
};

//分配权限初始化接口
export const userAuthListApi = (params) => {
  return http.get(PORT1+'/sys/user-auth/list', params, { cancel: false });
};
//分配权限保存
export const saveUserAuthApi = (params) => {
  return http.post(PORT1+'/sys/user-auth/set-list', params, { cancel: false });
};

//复制权限保存
export const saveCopyAuthApi = (params) => {
  return http.post(PORT1+'/sys/user-auth/copy', params, { cancel: false });
};



//获取权限分配用户列表tree结构
export const getUserListTreeApi = (params) => {
  return http.get(PORT1+'/personnel/user-set-auth/user-tree-list', params, { cancel: false });
};
//修改权限按钮禁止访问
export const editStatusApi = (params) => {
  return http.post(PORT1+'/personnel/user-set-auth/access-status', params, { cancel: false });
};

// 获取权限菜单树结构
export const listMenuApi = (params) => {
  return http.get(PORT1+'/sys/user-auth/list-menu', params, { cancel: false });
};
// 获取三四五级权限
export const getRightApi = (params) => {
  return http.get(PORT1+'/sys/user-auth/list-auth', params, { cancel: false });
};




